﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Services;

public partial class _Default : System.Web.UI.Page
{
    CommonPage cm2 = new CommonPage();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="userName"></param>
    /// <param name="email"></param>
    /// <param name="question"></param>
    /// <returns>
    /// 0 : that bai
    /// 1 : thành công
    /// </returns>
    [WebMethod]
    public static int InsertSupportModal(string userName, string email, string question)
    {
        if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(question))
            return 0;

        else
        {
            try
            {
                VLGDataContext _dataContext = new VLGDataContext();
                CommonPage _comment = new CommonPage();
                Support support = new Support();
                support.IsActive = false;
                support.TimeInput = DateTime.Now;
                support.UserName = userName;
                support.Email = email;
                support.Question = question;
                _dataContext.Supports.InsertOnSubmit(support);
                _dataContext.SubmitChanges();

                return 1;
            }
            catch
            {
                return 0;
            }
        }

    }
}
